<!DOCTYPE HTML>
<html  lang="zh" xmlns:th="http://www.thymeleaf.org">
<meta charset="utf-8">
<head th:include="include :: header"></head>
<body class="white-bg">
    <div class="wrapper wrapper-content animated fadeInRight ibox-content">
        <form class="form-horizontal m" id="form-goodsInfo-edit" th:object="${goodsInfo}">
            <input id="goodsId" name="goodsId" th:field="*{goodsId}"  type="hidden">
            <div class="form-group">	
                <label class="col-sm-2 control-label">餐饮名称：</label>
                <div class="col-sm-9">
                    <input id="goodsName" name="goodsName" th:field="*{goodsName}" class="form-control" type="text">
                </div>
            </div>
            <div class="form-group">	
                <label class="col-sm-2 control-label">简介说明：</label>
                <div class="col-sm-9">
                    <textarea id="briefInformation" name="briefInformation" th:field="*{briefInformation}" class="form-control"></textarea>
                </div>
            </div>
            <div class="form-group">	
                <label class="col-sm-2 control-label">类型：</label>
                <div class="col-sm-9">
                    <select id="goodsType" name="goodsType"  class="form-control" th:with="type=${@dict.getType('goods_type_item')}">
                        <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}" th:field="*{goodsType}"></option>
                    </select>
                </div>
            </div>
            <div class="form-group">	
                <label class="col-sm-2 control-label">首图：</label>
                <div class="col-sm-9">
                    <input id="file" name="file" class="form-control" accept="image/*" type="file">
                    <div style="color: red;">上传新图片将替换原图片，否则保留原图片。</div>
                    <img th:src="*{imgUrl}" style="width: 90px;height: 90px;">
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-2 control-label">原料：</label>
                <div class="col-sm-9">
                    <input id="attr1" name="attr1" th:field="*{attr1}" class="form-control" type="text">
                </div>
            </div>
            <div class="form-group">	
                <label class="col-sm-2 control-label">价格：</label>
                <div class="col-sm-3">
                    <input id="goodsPrice" name="goodsPrice" th:field="*{goodsPrice}" class="form-control" type="text">
                </div>
                <label class="col-sm-3 control-label">库存：</label>
                <div class="col-sm-3">
                    <input id="goodsLeft" name="goodsLeft" th:field="*{goodsLeft}" class="form-control" type="text">
                </div>
            </div>
            <div class="form-group">	
                <label class="col-sm-2 control-label">展示详情：</label>
                <div class="col-sm-9">
                    <div class="summernote" sn-data-id="details"></div>
                    <input id="details" name="details" th:field="*{details}" type="hidden">
                </div>
            </div>
		</form>
    </div>
    <div th:include="include::footer"></div>
    <script th:inline="javascript">
		var prefix = ctx + "system/goodsInfo"
		$("#form-goodsInfo-edit").validate({
			rules:{
                goodsName:{
                    required:true,
                },
                goodsPrice:{
                    required:true,
                    number:true
                },
                goodsLeft:{
                    required:true,
                    number:true
                },
			}
		});
		
		
        $.form.init({
            url:prefix + "/edit",
            beforeSubmit:function () {
                return $.validate.form();
            },
            success:function (result) {
                $.operate.successCallback(result);
            }
        });
        function submitHandler() {
            $('#form-goodsInfo-edit').submit();
        }
	</script>
</body>
</html>
